From: George Dunlap Date: Sat, 17 Sep 2011 15:22:54 +0000 (+0100) Subject: xen: Move tsc reliability check until after CPUs have booted X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~9890 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=375b9efe189caa4d1732286bde0a880681f224eb;p=xen.git xen: Move tsc reliability check until after CPUs have booted AMD CPUs by default enable X86_FEATURE_TSC_RELIABLE, and depend upon a later check to disable this feature if TSC drift is detected. Unfortunately, this check is done in time.c:init_xen_time(), which is done before any secondary CPUs are brought up, and is thus guaranteed to succed. This patch moves the check into its own function, and calls it after cpus are brought up. Signed-off-by: George Dunlap --- diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 83d59025d1..5e45566870 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1292,8 +1292,11 @@ void __init __start_xen(unsigned long mbi_p) printk("Brought up %ld CPUs\n", (long)num_online_cpus()); smp_cpus_done(); + verify_tsc_reliability(); + do_initcalls(); + if ( opt_watchdog ) watchdog_setup(); diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 26388205d4..61320c4900 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1450,8 +1450,8 @@ static void __init tsc_check_writability(void) disable_tsc_sync = 1; } -/* Late init function (after interrupts are enabled). */ -int __init init_xen_time(void) +/* Late init function, after all cpus have booted */ +void __init verify_tsc_reliability(void) { if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) ) { @@ -1463,9 +1463,17 @@ int __init init_xen_time(void) */ tsc_check_reliability(); if ( tsc_max_warp ) + { + printk("%s: TSC warp detected, disabling TSC_RELIABLE\n", + __func__); setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); + } } +} +/* Late init function (after interrupts are enabled). */ +int __init init_xen_time(void) +{ tsc_check_writability(); /* If we have constant-rate TSCs then scale factor can be shared. */ diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h index a19434079c..068c742156 100644 --- a/xen/include/xen/time.h +++ b/xen/include/xen/time.h @@ -11,6 +11,7 @@ #include #include +extern void verify_tsc_reliability(void); extern int init_xen_time(void); extern void cstate_restore_tsc(void);